import { useStore } from 'src/plugins/pinia';
import { whitePages } from 'src/plugins/http/whitePages';
import { UtilTools, getCurPage } from 'src/plugins/utils';
const { user } = useStore();

export default config => {
    return new Promise((resolve, reject) => {
        const page = getCurPage().route;
        config.header = UtilTools.extend({
            'content-type': 'application/json; charset=UTF-8',
        }, config.header);
        config.data = UtilTools.typeIs(config.data) === 'object' ? {
            'token': '123456',
            ...config.data
        } : config.data;
        if (whitePages.includes(page)) {
            resolve(config);
        }
		 else {
            resolve(config);
        }
    });
};